<?php

namespace app\controllers;

use app\models\UserLogin;
use Yii;
use yii\helpers\Url;

class LoginController extends \yii\web\Controller {
    public function actionLoginOut() {
        Yii::$app->session->open();
        // 清除自动登录的redis
        UserLogin::clearAutoLogin();
        Yii::$app->session->destroy();

        $authcenterLoginOutUrl = 'http://' . \Yii::$app->params['AUTHCENTER_DOMAIN'] . '/authcenter/login/login-out?redirect=' . urlencode(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Url::base(true));
        $this->redirect($authcenterLoginOutUrl);
    }
}
